package com.spring.activity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import com.spring.adapter.AKQInfoAdapter;
import com.spring.entity.Attendance;
import com.spring.gowhere.R;

import java.util.List;

public class AKQInfoActivity extends BaseActivity {
	private TextView title_tv;
	private AKQInfoAdapter mAdapter;
	private ListView mListView;
	private ImageButton mImageBtnBack;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		Log.d("TT","AKQ....OnCREATE--");
		setContentView(R.layout.akqinfo);
		title_tv = (TextView) findViewById(R.id.title_tv);
		title_tv.setText("考勤明细");
		mImageBtnBack = (ImageButton) findViewById(R.id.title_left_ib);
		mImageBtnBack.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				AKQInfoActivity.this.finish();
			}
		});
		mListView = (ListView) findViewById(R.id.xflistview);

		Intent intent = getIntent();
		// 获取该Intent所携带的数据
		Bundle bundle = intent.getExtras();
		// 从bundle数据包中取出数据

		List<Attendance>mList= (List<Attendance>) bundle
				.getSerializable("table");
		if(mList!=null && mList.size()>0){
			Log.d("TT","AKQ....OnCREATE--111");
			initAdapter(mList);

		}else{
			Toast.makeText(AKQInfoActivity.this, "没有查询到相关数据", Toast.LENGTH_SHORT).show();
		}


	}
	public void initAdapter(List<Attendance> mlist){
		if(mAdapter==null){
			mAdapter = new AKQInfoAdapter(this,mlist);
			mListView.setAdapter(mAdapter);
		}
		mAdapter.notifyDataSetChanged();

	}
}
